package com.example.dahua.adapter.objectAdapter;

import com.example.dahua.adapter.classAdapter.Adaptee;
import com.example.dahua.adapter.classAdapter.Target;

/**
 * @author: dangwen
 * @createDate: 2021/7/3
 * 对象的适配器模式是通过注入对象的方式实现的。
 */
public class Adapter implements Target {
    private Adaptee adaptee;
    public Adapter(Adaptee adaptee){
        this.adaptee = adaptee;
    }
    @Override
    public void commonRequest() {
        this.adaptee.specialRequest();
    }

    public static void main(String[] args) {
        Adaptee adaptee = new Adaptee();
        Adapter adapter = new Adapter(adaptee);
        adapter.commonRequest();
    }
}
